<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/11/17
 * Time: 21:38
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\admin\controller;

use app\common\business\TheatreCate as BusObj;
use app\common\lib\Show;
use app\common\lib\Status;
use think\App;
use think\Exception;

class TheatreCate extends Base
{
    protected BusObj $busObj;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->busObj = new BusObj();
    }

    public function index()
    {
        $this->indexField = "*,venue as get_venue";
        return parent::index(); // TODO: Change the autogenerated stub
    }

    /**
     * 获取剧场
     * @return \think\response\Json
     */
    public function getTheatreCateByList()
    {
        $venueId = $this->request->param('venueId',0,'intval');
        if($venueId == 0){
            return Show::json_show(Status::status_error,"内部异常");
        }
        try {
            $lists = $this->busObj->getTheatreCateByVenueId($venueId,"id as value,title as name");
        } catch (\Exception $e) {
            return Show::json_show(Status::status_error, $e->getMessage());
        }
        return Show::json_show(Status::status_normal, "ok", $lists);
    }
}